<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>学生管理系统-学生信息</title>
    <style>
        table,form{
            width: 500px;
            margin: auto;
            text-align: center;
        }
        div{
            width: 500px;
            margin: auto;
            text-align:right;
        }
    </style>
</head>
<body>
<div>
    <a href="addStudent.jsp">新增学生</a>
</div>
<form action="studentServlet" method="post">
    <input type="hidden" name="flag" value="getStudentBySname">
    <input type="hidden" name="page" value="1">
    学生姓名：<input type="text" name="sname" value="${sname}">
    <input type="submit" value="搜索">
</form>
<table cellpadding="0" cellspacing="0" border="1">
    <tr>
        <th>学号</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>性别</th>
        <th>邮箱</th>
        <th>头像</th>
        <th>删除</th>
        <th>修改</th>
    </tr>
    <c:forEach var="stu" items="${stuList}">
        <tr>
            <td>${stu.sid}</td>
            <td>${stu.sname}</td>
            <td>${stu.sage}</td>
            <td>${stu.ssex}</td>
            <td>${stu.semail}</td>
            <td><img src="http://localhost:8080/pic/${stu.sphoto}" width="30"></td>
            <td>
                <a href="studentServlet?flag=delStudent&sid=${stu.sid}">删除</a>
            </td>
            <td>
                <a href="studentServlet?flag=getStudentById&sid=${stu.sid}">修改</a>
            </td>
        </tr>
    </c:forEach>
</table>
<div align="center">
    <a href="studentServlet?flag=getStudentByPage&page=1">首页</a>
    <a href="studentServlet?flag=getStudentByPage&page=${pu.prevPage}">上一页</a>
    ${pu.page}/${pu.countPage}
    <a href="studentServlet?flag=getStudentByPage&page=${pu.nextPage}">下一页</a>
    <a href="studentServlet?flag=getStudentByPage&page=${pu.countPage}">尾页</a>
</div>
</body>
</html>
